<div class="detailsBox">
      <h3 class="mt20"><i class="jtIco"></i> 总部归档</h3>
       <form id="archiveRecordForm" action="/archive/rest/v1/saveArchiveRecords" class="action-ajax-form" method="post">
       <div class="cktitle" style="margin-top:10px;"><span class="xiala"></span>银行归档</div>
       <div class="m10 detaiTab" style="border-right:1px solid #e1e1e1; border-left:1px solid #e1e1e1">
                <table data="${FORMTYPE_BANK}" width="100%" border="0" cellspacing="0" cellpadding="0" class="b_t_e5">
                    <tbody>
                    	<#list 0..(bankFields?size/3)?ceiling-1 as x> 
                    	 	<tr>
                    	 		<#list 0..2 as index> 
	                    	 		<#if bankFields[x*3+index]??>
			                            <td align="right" class="bg " width="15%"><span><font color="red">*</font></span>${bankFields[x*3+index].fieldName}</td>
			                            <td class="fieldVaule" data="${bankFields[x*3+index].fieldName}">
			                            <select>
			                            	<option>请选择</option>
			                            	<#list bankFields[x*3+index].fieldMin..bankFields[x*3+index].fieldMax as i> 
			                            		<#if bankFields[x*3+index].fieldValue?? && bankFields[x*3+index].fieldValue ==i >
			                            			<option selected="selected">${i}</option>
			                            		<#else>
			                            			<#if bankFields[x*3+index].fieldMin?? && bankFields[x*3+index].fieldMin ==i >
				                            			<option selected="selected">${i}</option>
				                            		<#else>
				                            			<option>${i}</option>
				                            		</#if>
			                            		</#if>
			                            	</#list>
			                            </select>
			                                                       份</td>
	                    	 		<#else>
	                    	 			<td align="right" class="bg" width="15%"></td>
			                            <td></td>
	                    	 		</#if>
                    	 		</#list>
	                        </tr>
						</#list>
                    </tbody>
                </table> 
            </div>
            
       <div class="cktitle"><span class="xiala"></span>财务行归档</div>
       <div class="m10 detaiTab" style="border-right:1px solid #e1e1e1; border-left:1px solid #e1e1e1">
                <table data="${FORMTYPE_FINANCE}" width="100%" border="0" cellspacing="0" cellpadding="0" class="b_t_e5">
                    <tbody>
                       <#list 0..(financeFields?size/3)?ceiling-1 as x> 
                    	 	<tr>
                    	 		<#list 0..2 as index> 
	                    	 		<#if financeFields[x*3+index]??>
			                            <td align="right" class="bg " width="15%"><span><font color="red">*</font></span>${financeFields[x*3+index].fieldName}</td>
			                            <td class="fieldVaule" data="${financeFields[x*3+index].fieldName}">
			                            <select>
			                          	    <option>请选择</option>
			                            	<#list financeFields[x*3+index].fieldMin..financeFields[x*3+index].fieldMax as i> 
			                            		<#if financeFields[x*3+index].fieldValue?? && financeFields[x*3+index].fieldValue ==i >
			                            			<option selected="selected">${i}</option>
			                            		<#else>
			                            			<#if financeFields[x*3+index].fieldMin?? && financeFields[x*3+index].fieldMin ==i >
				                            			<option selected="selected">${i}</option>
				                            		<#else>
				                            			<option>${i}</option>
				                            		</#if>
			                            		</#if>
			                            	</#list>
			                            </select>
			                                                       份</td>
	                    	 		<#else>
	                    	 			<td align="right" class="bg" width="15%"></td>
			                            <td></td>
	                    	 		</#if>
                    	 		</#list>
	                        </tr>
						</#list>
                    </tbody>
                </table> 
            </div>
       <div class="cktitle"><span class="xiala"></span>存柜资料</div>
       <div class="m10 detaiTab" style="border-right:1px solid #e1e1e1; border-left:1px solid #e1e1e1">
                <table data="${FORMTYPE_ARCHIVE_INFO}" width="100%" border="0" cellspacing="0" cellpadding="0" class="b_t_e5">
                    <tbody>
                        <#list 0..(archiveFields?size/3)?ceiling-1 as x> 
                    	 	<tr>
                    	 		<#list 0..2 as index> 
	                    	 		<#if archiveFields[x*3+index]??>
			                            <td align="right" class="bg " width="15%"><span><font color="red">*</font></span>${archiveFields[x*3+index].fieldName}</td>
			                            <td class="fieldVaule" data="${archiveFields[x*3+index].fieldName}">
			                            <select>
			                            	<option>请选择</option>
			                            	<#list archiveFields[x*3+index].fieldMin..archiveFields[x*3+index].fieldMax as i> 
			                            		<#if archiveFields[x*3+index].fieldValue?? && archiveFields[x*3+index].fieldValue ==i >
			                            			<option selected="selected">${i}</option>
			                            		<#else>
			                            			<#if archiveFields[x*3+index].fieldMin?? && archiveFields[x*3+index].fieldMin ==i >
				                            			<option selected="selected">${i}</option>
				                            		<#else>
				                            			<option>${i}</option>
				                            		</#if>
			                            		</#if>
			                            	</#list>
			                            </select>
			                                                       份</td>
	                    	 		<#else>
	                    	 			<td align="right" class="bg" width="15%"></td>
			                            <td></td>
	                    	 		</#if>
                    	 		</#list>
	                        </tr>
						</#list>
                        <tr>
                        	<td align="right" class="bg " width="15%">档案柜号</td>
                            <td> <input disabled type="text" value="${archiveRecord.cabinetNo}" /></td>
                            <td align="right" class="bg " width="15%">档案编号</td>
                            <td> <input disabled type="text" value="${archiveRecord.archiveNo}" /></td>
                            <td align="right" class="bg " width="15%"></td>
                            <td></td>
                        </tr>
                    </tbody>
                </table> 
            </div>
            <input id="loanapplyNoArchive" type="hidden" value="${loanapplyNo}"/>
            <input id="bankTypeIdArchive" type="hidden" value="${bankTypeId}"/>
            <input id="jsonArchive" name="archiveRecordJSON" type="hidden"/>
            </form>
    </div>
  <div class=" mtb20 tac">
  	<span id="archiveErrorMsg" style="disploy:none;" class="red"></span></br>
  	<#if showSaveBtn??>
  		<a id="saveArchiveRecordBtn" href="#" class="btn_auto_30 btn_blue">保 存</a>
  	</#if>
  	<input id="showSaveBtn" type="hidden" value="${showSaveBtn}"/>
  </div>
<@js>
	if(!$('#showSaveBtn').val()){
		$('.detailsBox select').attr('disabled','disabled');
	}
	$("#saveArchiveRecordBtn").click(function(){
		var checkSelect=1;
		var errorMsg="";
		var archiveRecordJSON={};
		var loanapplyNo=$('#loanapplyNoArchive').val();
		var bankTypeId=$('#bankTypeIdArchive').val();
		$('#archiveRecordForm table').each(function(i,item){
			var formTypeId=$(item).attr('data');
			var contentJson={};
			$(item).find('.fieldVaule').each(function(f,field){
				var key=$(field).attr('data');
				var value=$(field).find('select').val();
				contentJson[key]=value;
				if(value=="请选择"){
					checkSelect=0;
					errorMsg=key+"不能为空!";
					return false;
				}
			});
			var json={'loanapplyNo':loanapplyNo,'bankTypeId':bankTypeId,'formTypeId':formTypeId,'contentJson':JSON.stringify(contentJson)};
			archiveRecordJSON[formTypeId]=json;
		});
		if(!checkSelect){
			$('#archiveErrorMsg').text(errorMsg).show();
			return;
		}
		$('#archiveErrorMsg').text('').hide();
		$('#jsonArchive').val(JSON.stringify(archiveRecordJSON));
		$('#archiveRecordForm').submit();
   });
</@js>
<@jsRender/>